rme 0.0.74 → 0.0.76

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.mjs CHANGED
@@ -4372,15 +4372,17 @@ var require_querystringify = __commonJS({
4372
4372
  // src/editor/components/SourceEditor/index.tsx
4373
4373
  import { Remirror as Remirror2 } from "@remirror/react";
4374
4374
  import { createContextState } from "create-context-state";
4375
- import { memo as memo6, useCallback as useCallback5, useMemo as useMemo5 } from "react";
4375
+ import { memo as memo7, useCallback as useCallback5, useMemo as useMemo5 } from "react";
4376
4376
 
4377
4377
  // src/editor/components/Text/index.tsx
4378
4378
  import { useRemirrorContext } from "@remirror/react";
4379
+ import { memo } from "react";
4379
4380
  import { jsx } from "react/jsx-runtime";
4380
- var Text = ({ children, ...props }) => {
4381
+ var Text = memo(({ children, ...props }) => {
4381
4382
  const { getRootProps } = useRemirrorContext();
4382
- return /* @__PURE__ */ jsx("div", { ...props, ...getRootProps(), spellCheck: false, children });
4383
- };
4383
+ const { key, ...rootProps } = getRootProps();
4384
+ return /* @__PURE__ */ jsx("div", { ...props, ...rootProps, spellCheck: false, children });
4385
+ });
4384
4386
  var Text_default = Text;
4385
4387
 
4386
4388
  // src/editor/components/SourceEditor/index.tsx
@@ -4474,26 +4476,93 @@ function buildHtmlStringFromAst(ast) {
4474
4476
 
4475
4477
  // src/editor/transform/markdown-it-html-inline.ts
4476
4478
  import Token2 from "markdown-it/lib/token.mjs";
4479
+ import voidElements from "void-elements";
4477
4480
  var needSplitInlineHtmlTokenTags = ["img", "iframe", "br"];
4478
- var excludeHtmlInlineNodes = ["html_image", "iframe_inline", "html_br"];
4481
+ var excludeHtmlInlineNodes = ["html_inline_node", "html_image", "iframe_inline", "html_br"];
4479
4482
  var typeMap = {
4480
4483
  img: "html_image",
4481
4484
  iframe: "iframe_inline",
4482
4485
  br: "html_br"
4483
4486
  };
4484
- function splitHtmlInlineTokens(t3) {
4485
- if (!t3.children)
4486
- return [];
4487
- return t3.children.map((child) => {
4488
- if (isHtmlInlineToken(child) && needSplitInlineHtmlTokenTags.includes(child.tag) && !isClosingTag(child.content)) {
4489
- const newToken = new Token2(typeMap[child.tag], "", 0);
4490
- newToken.content = child.content;
4491
- newToken.attrs = getAttrsBySignalHtmlContent(child.content);
4492
- return newToken;
4493
- } else {
4494
- const token = new Token2("text", "", 0);
4495
- token.content = child.content;
4496
- return token;
4487
+ function getMergeArr(phrasingContents) {
4488
+ const unCloseedHtmlStack = [];
4489
+ const mergeArr = [];
4490
+ for (let i = 0; i < phrasingContents.length; i++) {
4491
+ const phrasingContent = phrasingContents[i];
4492
+ if (isHtmlInlineToken(phrasingContent)) {
4493
+ const tagName = getTagName(phrasingContent.content);
4494
+ const htmlNode = {
4495
+ tag: tagName,
4496
+ voidElement: !!voidElements[tagName],
4497
+ isClosingTag: isClosingTag(phrasingContent.content),
4498
+ index: i
4499
+ };
4500
+ if (!htmlNode.voidElement) {
4501
+ if (!htmlNode.isClosingTag) {
4502
+ unCloseedHtmlStack.push(htmlNode);
4503
+ } else if (unCloseedHtmlStack[unCloseedHtmlStack.length - 1]?.tag === htmlNode.tag) {
4504
+ if (unCloseedHtmlStack.length >= 1) {
4505
+ mergeArr.push([unCloseedHtmlStack.pop(), htmlNode]);
4506
+ phrasingContent.complete = true;
4507
+ }
4508
+ }
4509
+ } else {
4510
+ phrasingContent.complete = true;
4511
+ }
4512
+ }
4513
+ }
4514
+ for (let i = 0; i < mergeArr.length; i++) {
4515
+ const merge = mergeArr[i];
4516
+ const startIndex = merge[0].index;
4517
+ const endIndex = merge[1].index;
4518
+ const parentNode = mergeArr.findIndex(
4519
+ (item) => item[0].index < startIndex && item[1].index > endIndex
4520
+ );
4521
+ if (parentNode >= 0) {
4522
+ mergeArr.splice(i, 1);
4523
+ i--;
4524
+ }
4525
+ }
4526
+ return mergeArr;
4527
+ }
4528
+ function mergePhrasingContents(phrasingContents, startIndex, endIndex) {
4529
+ const merged = new Token2("html_inline_node", "", 0);
4530
+ for (let i = startIndex; i <= endIndex; i++) {
4531
+ merged.content += phrasingContents[i].content || "";
4532
+ merged.complete = true;
4533
+ }
4534
+ merged.attrs = {
4535
+ htmlText: merged.content
4536
+ };
4537
+ phrasingContents.splice(startIndex, endIndex - startIndex + 1, merged);
4538
+ return phrasingContents;
4539
+ }
4540
+ function mergeHtmlPhrasingContents(phrasingContents) {
4541
+ const mergeArr = getMergeArr(phrasingContents);
4542
+ let offset = 0;
4543
+ mergeArr.forEach((merge) => {
4544
+ const startIndex = merge[0].index + offset;
4545
+ const endIndex = merge[1].index + offset;
4546
+ mergePhrasingContents(phrasingContents, startIndex, endIndex);
4547
+ offset += startIndex - endIndex;
4548
+ });
4549
+ phrasingContents.forEach((phrasingContent, index) => {
4550
+ if (isHtmlInlineToken(phrasingContent)) {
4551
+ const tagName = getTagName(phrasingContent.content);
4552
+ if (typeMap[tagName]) {
4553
+ const newToken = new Token2(typeMap[tagName], "", 0);
4554
+ newToken.content = phrasingContent.content;
4555
+ newToken.attrs = getAttrsBySignalHtmlContent(phrasingContent.content);
4556
+ newToken.attrs.htmlText = newToken.content;
4557
+ phrasingContents.splice(index, 1, newToken);
4558
+ } else {
4559
+ const newToken = new Token2("html_inline_node", "", 0);
4560
+ newToken.content = phrasingContent.content;
4561
+ newToken.attrs = {
4562
+ htmlText: newToken.content
4563
+ };
4564
+ phrasingContents.splice(index, 1, newToken);
4565
+ }
4497
4566
  }
4498
4567
  });
4499
4568
  }
@@ -4506,28 +4575,41 @@ function isHtmlInlineToken(t3) {
4506
4575
  function isHtmlBlockToken(t3) {
4507
4576
  return t3.type === "html_block";
4508
4577
  }
4509
- function hasSplitInlineHtmlToken(t3) {
4510
- let res = false;
4511
- t3.children?.forEach((child) => {
4512
- if (isHtmlInlineToken(child)) {
4513
- const tag = getTagName(child.content);
4514
- child.tag = tag;
4515
- if (needSplitInlineHtmlTokenTags.includes(child.tag)) {
4516
- res = true;
4517
- }
4518
- }
4519
- });
4520
- return res;
4521
- }
4522
4578
  var rule2 = (state) => {
4523
4579
  const edited = false;
4524
4580
  const tokens = state.tokens;
4525
4581
  const tokensLength = tokens.length;
4526
- for (let i = tokensLength - 1; i >= 0; i--) {
4582
+ for (let i = 0; i <= tokensLength - 1; i++) {
4527
4583
  const curToken = tokens[i];
4528
4584
  if (isInlineToken2(curToken)) {
4529
- if (hasSplitInlineHtmlToken(curToken)) {
4530
- tokens.splice(i, 1, ...splitHtmlInlineTokens(curToken));
4585
+ const newChildren = curToken.children;
4586
+ if (newChildren) {
4587
+ mergeHtmlPhrasingContents(newChildren);
4588
+ }
4589
+ const newTokens = [];
4590
+ let childs = [];
4591
+ newChildren?.forEach((child, index) => {
4592
+ if (excludeHtmlInlineNodes.includes(child.type)) {
4593
+ if (childs.length > 0) {
4594
+ const newToken = new Token2("inline", "", 0);
4595
+ newToken.children = [...childs];
4596
+ newTokens.push(newToken);
4597
+ childs.length = 0;
4598
+ }
4599
+ newTokens.push(child);
4600
+ } else {
4601
+ childs.push(child);
4602
+ }
4603
+ });
4604
+ if (childs.length > 0) {
4605
+ const newToken = new Token2("inline", "", 0);
4606
+ newToken.children = childs;
4607
+ newToken.content = childs.map((child) => child.content).join("");
4608
+ newTokens.push(newToken);
4609
+ childs = [];
4610
+ }
4611
+ if (curToken.children && newTokens.length > 0) {
4612
+ tokens.splice(i, 1, ...newTokens);
4531
4613
  }
4532
4614
  } else if (isHtmlBlockToken(curToken)) {
4533
4615
  const tag = getTagName(curToken.content);
@@ -4729,7 +4811,15 @@ function buildTokenHandlers(schema, parserRules) {
4729
4811
  var MarkdownParser = class {
4730
4812
  constructor(schema, parserRules) {
4731
4813
  this.schema = schema;
4732
- this.tokenizer = MarkdownIt("commonmark", { html: true }).disable(["emphasis", "autolink", "backticks", "entity", "reference"]).enable(["table"]).use(markdown_it_list_checkbox_default).use(markdown_it_html_inline_default);
4814
+ this.tokenizer = MarkdownIt("commonmark", { html: true }).disable([
4815
+ "emphasis",
4816
+ "autolink",
4817
+ "backticks",
4818
+ "entity",
4819
+ "reference",
4820
+ "image",
4821
+ "link"
4822
+ ]).enable(["table"]).use(markdown_it_html_inline_default).use(markdown_it_list_checkbox_default);
4733
4823
  this.tokenHandlers = buildTokenHandlers(schema, parserRules);
4734
4824
  }
4735
4825
  parse(text) {
@@ -5541,7 +5631,7 @@ import { gfmStrikethroughFromMarkdown } from "mdast-util-gfm-strikethrough";
5541
5631
  import { gfmAutolinkLiteral } from "micromark-extension-gfm-autolink-literal";
5542
5632
  import { gfmStrikethrough } from "micromark-extension-gfm-strikethrough";
5543
5633
  import { nanoid } from "nanoid";
5544
- import voidElements from "void-elements";
5634
+ import voidElements2 from "void-elements";
5545
5635
  import { cloneDeep } from "lodash";
5546
5636
  gfmAutolinkLiteralFromMarkdown.transforms = [];
5547
5637
  function fixMarkNames(marks) {
@@ -5804,6 +5894,7 @@ var fromMarkdownOptions = {
5804
5894
  "definition",
5805
5895
  "headingAtx",
5806
5896
  "htmlFlow",
5897
+ "htmlText",
5807
5898
  "list",
5808
5899
  "thematicBreak"
5809
5900
  ]
@@ -5855,114 +5946,10 @@ function parseMdInline(phrasingContents, depth = 1) {
5855
5946
  }
5856
5947
  return inlineTokens;
5857
5948
  }
5858
- function mergePhrasingContents(phrasingContents, startIndex, endIndex) {
5859
- const merged = cloneDeep(phrasingContents[startIndex]);
5860
- for (let i = startIndex + 1; i <= endIndex; i++) {
5861
- merged.value += phrasingContents[i].value || "";
5862
- merged.position.end = phrasingContents[i].position.end;
5863
- merged.complete = true;
5864
- }
5865
- phrasingContents.splice(startIndex, endIndex - startIndex + 1, merged);
5866
- return phrasingContents;
5867
- }
5868
- function getMergeArr(phrasingContents) {
5869
- const unCloseedHtmlStack = [];
5870
- const mergeArr = [];
5871
- for (let i = 0; i < phrasingContents.length; i++) {
5872
- const phrasingContent = phrasingContents[i];
5873
- if (phrasingContent.type === "html") {
5874
- const tagName = getTagName(phrasingContent.value);
5875
- const htmlNode = {
5876
- tag: tagName,
5877
- voidElement: !!voidElements[tagName],
5878
- isClosingTag: isClosingTag(phrasingContent.value),
5879
- index: i
5880
- };
5881
- if (!htmlNode.voidElement) {
5882
- if (!htmlNode.isClosingTag) {
5883
- unCloseedHtmlStack.push(htmlNode);
5884
- } else if (unCloseedHtmlStack[unCloseedHtmlStack.length - 1]?.tag === htmlNode.tag) {
5885
- if (unCloseedHtmlStack.length >= 1) {
5886
- mergeArr.push([unCloseedHtmlStack.pop(), htmlNode]);
5887
- phrasingContent.complete = true;
5888
- }
5889
- }
5890
- } else {
5891
- phrasingContent.complete = true;
5892
- }
5893
- }
5894
- }
5895
- for (let i = 0; i < mergeArr.length; i++) {
5896
- const merge = mergeArr[i];
5897
- const startIndex = merge[0].index;
5898
- const endIndex = merge[1].index;
5899
- const parentNode = mergeArr.findIndex(
5900
- (item) => item[0].index < startIndex && item[1].index > endIndex
5901
- );
5902
- if (parentNode >= 0) {
5903
- mergeArr.splice(i, 1);
5904
- i--;
5905
- }
5906
- }
5907
- return mergeArr;
5908
- }
5909
- function mergeHtmlPhrasingContents(phrasingContents) {
5910
- const mergeArr = getMergeArr(phrasingContents);
5911
- let offset = 0;
5912
- mergeArr.forEach((merge) => {
5913
- const startIndex = merge[0].index + offset;
5914
- const endIndex = merge[1].index + offset;
5915
- mergePhrasingContents(phrasingContents, startIndex, endIndex);
5916
- offset += startIndex - endIndex;
5917
- });
5918
- }
5919
- function hasHtmlToken(mdastToken) {
5920
- for (const token of mdastToken) {
5921
- if (token.type === "html" && !needSplitInlineHtmlTokenTags.includes(getTagName(token.value))) {
5922
- return true;
5923
- }
5924
- }
5925
- return false;
5926
- }
5927
- function flatHTMLInlineCode(phrasingContents, depth = 1) {
5928
- mergeHtmlPhrasingContents(phrasingContents);
5929
- const inlineTokens = [];
5930
- phrasingContents.forEach((phrascontent) => {
5931
- if (phrascontent.type === "html") {
5932
- if (phrascontent.complete) {
5933
- inlineTokens.push({
5934
- marks: ["mdHtmlInline"],
5935
- attrs: {
5936
- depth: 1,
5937
- htmlText: phrascontent.value,
5938
- key: nanoid(),
5939
- first: true,
5940
- last: true
5941
- },
5942
- start: phrascontent.position.start.offset,
5943
- end: phrascontent.position.end.offset
5944
- });
5945
- } else {
5946
- inlineTokens.push({
5947
- marks: ["mdText"],
5948
- attrs: { depth, first: true, last: true },
5949
- start: phrascontent.position.start.offset,
5950
- end: phrascontent.position.end.offset
5951
- });
5952
- }
5953
- } else {
5954
- const tokens = flatPhrasingContent(phrascontent, depth);
5955
- inlineTokens.push(...fixTokensMarkNames(tokens));
5956
- }
5957
- });
5958
- return inlineTokens;
5959
- }
5960
5949
  function fromInlineMarkdown(text) {
5961
5950
  const phrasingContents = parseInlineMarkdown(text);
5962
- if (hasHtmlToken(phrasingContents)) {
5963
- return flatHTMLInlineCode(phrasingContents);
5964
- }
5965
- return parseMdInline(phrasingContents);
5951
+ const res = parseMdInline(phrasingContents);
5952
+ return res;
5966
5953
  }
5967
5954
 
5968
5955
  // src/editor/extensions/Inline/inline-mark-helpers.ts
@@ -5970,14 +5957,14 @@ function parseTextBlock(schema, node, startPos, output) {
5970
5957
  if (!node.textContent) {
5971
5958
  return;
5972
5959
  }
5973
- const offsetPoss = [];
5960
+ let offsetPoss = [];
5974
5961
  let pos = 0;
5975
5962
  for (let i = 0; i < node.childCount; i++) {
5976
5963
  const child = node.child(i);
5964
+ pos += child.nodeSize;
5977
5965
  if (excludeHtmlInlineNodes.includes(child.type.name)) {
5978
5966
  offsetPoss.push(pos);
5979
5967
  }
5980
- pos += child.nodeSize;
5981
5968
  }
5982
5969
  const tokens = fromInlineMarkdown(node.textContent);
5983
5970
  let totalOffset = 0;
@@ -5985,12 +5972,20 @@ function parseTextBlock(schema, node, startPos, output) {
5985
5972
  const expectedMarks = token.marks.map((markName) => {
5986
5973
  return schema.marks[markName].create(token.attrs);
5987
5974
  });
5988
- let start = token.start;
5989
- let end = token.end;
5990
- const offset = offsetPoss.filter((pos2) => pos2 >= start && pos2 < end).length;
5975
+ let start = token.start + totalOffset;
5976
+ let end = token.end + totalOffset;
5977
+ const offsetPos = offsetPoss.filter((pos2) => pos2 >= start && pos2 < end);
5978
+ const offset = offsetPos.length;
5991
5979
  totalOffset += offset;
5980
+ if (output[output.length - 1]?.[1] - 1 === offsetPos[0] && offsetPos.length > 0) {
5981
+ output[output.length - 1] = [
5982
+ output[output.length - 1][0] + 1,
5983
+ output[output.length - 1][1] + 1,
5984
+ output[output.length - 1][2]
5985
+ ];
5986
+ }
5992
5987
  output.push([
5993
- startPos + token.start + totalOffset - offset,
5988
+ startPos + token.start + totalOffset,
5994
5989
  startPos + token.end + totalOffset,
5995
5990
  expectedMarks
5996
5991
  ]);
@@ -6887,7 +6882,7 @@ function rotateIndex(index, length) {
6887
6882
 
6888
6883
  // src/editor/components/WysiwygEditor/index.tsx
6889
6884
  import { Remirror } from "@remirror/react";
6890
- import { memo as memo4, useMemo as useMemo4, useCallback as useCallback3 } from "react";
6885
+ import { memo as memo5, useMemo as useMemo4, useCallback as useCallback3 } from "react";
6891
6886
 
6892
6887
  // src/editor/theme/codemirror/dark.ts
6893
6888
  import { tags as t } from "@lezer/highlight";
@@ -7234,7 +7229,6 @@ var WysiwygThemeWrapper = styled.div.attrs((p) => ({
7234
7229
  padding: 0;
7235
7230
  }
7236
7231
 
7237
-
7238
7232
  & input[type='checkbox'] {
7239
7233
  /* Add if not using autoprefixer */
7240
7234
  -webkit-appearance: none;
@@ -7271,8 +7265,7 @@ var WysiwygThemeWrapper = styled.div.attrs((p) => ({
7271
7265
  transform: scale(0);
7272
7266
  transform-origin: bottom left;
7273
7267
  transition: 120ms transform ease-in-out;
7274
- /* Windows High Contrast Mode */
7275
- background-color: CanvasText;
7268
+ background-color: ${(props) => props.theme.bgColor};
7276
7269
  }
7277
7270
 
7278
7271
  & input[type='checkbox']:focus {
@@ -7546,16 +7539,6 @@ var WysiwygThemeWrapper = styled.div.attrs((p) => ({
7546
7539
  padding-right: 20px;
7547
7540
  }
7548
7541
 
7549
- & code,
7550
- & tt {
7551
- padding: 0.2em 0.4em;
7552
- margin: 0;
7553
- font-size: 0.85em;
7554
- white-space: break-spaces;
7555
- background-color: rgba(110, 118, 129, 0.4);
7556
- border-radius: 6px;
7557
- }
7558
-
7559
7542
  & code br,
7560
7543
  & tt br {
7561
7544
  display: none;
@@ -7755,6 +7738,39 @@ var WysiwygThemeWrapper = styled.div.attrs((p) => ({
7755
7738
  transition: all 0.3s;
7756
7739
  }
7757
7740
 
7741
+ .inline-node-show {
7742
+ display: inline-block;
7743
+ }
7744
+
7745
+ .inline-html {
7746
+ position: relative;
7747
+ }
7748
+
7749
+ .inline-html-src {
7750
+ display: inline;
7751
+ padding: 0.2em 0.4em;
7752
+ margin: 0;
7753
+ background-color: ${(props) => props.theme.codeBgColor};
7754
+ border-radius: 6px;
7755
+ }
7756
+
7757
+ .inline-html-preview {
7758
+ position: absolute;
7759
+ top: calc(100% + 0.5em);
7760
+ left: 50%;
7761
+ transform: translateX(-50%);
7762
+ width: max-content;
7763
+ padding: 0.5em 1em;
7764
+ max-width: 400px;
7765
+ border-radius: 0.2em;
7766
+ background-color: ${(props) => props.theme.bgColor};
7767
+ z-index: 1;
7768
+ }
7769
+
7770
+ .inline-html-render {
7771
+ display: inline-block;
7772
+ }
7773
+
7758
7774
  .html-node {
7759
7775
  position: relative;
7760
7776
  min-height: 40px;
@@ -7770,7 +7786,7 @@ var WysiwygThemeWrapper = styled.div.attrs((p) => ({
7770
7786
  }
7771
7787
 
7772
7788
  & .ProseMirror-focused {
7773
- outline: 2px solid ${(props) => props.theme.accentColor};
7789
+ outline: none;
7774
7790
  }
7775
7791
 
7776
7792
  .img-input__container {
@@ -8534,13 +8550,13 @@ var TableToolbar_default = TableToolbar;
8534
8550
  import { ProsemirrorDevTools } from "@remirror/dev";
8535
8551
 
8536
8552
  // src/editor/components/ErrorBoundary.tsx
8537
- import React from "react";
8553
+ import React2 from "react";
8538
8554
  import styled5 from "styled-components";
8539
8555
  import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
8540
8556
  var Title = styled5.h1`
8541
8557
  color: ${({ theme }) => theme.dangerColor};
8542
8558
  `;
8543
- var ErrorBoundary = class extends React.Component {
8559
+ var ErrorBoundary = class extends React2.Component {
8544
8560
  constructor(props) {
8545
8561
  super(props);
8546
8562
  this.state = { hasError: this.props.hasError ?? false };
@@ -8553,6 +8569,7 @@ var ErrorBoundary = class extends React.Component {
8553
8569
  }
8554
8570
  render() {
8555
8571
  if (this.state.hasError) {
8572
+ console.error(this.props.error);
8556
8573
  return /* @__PURE__ */ jsxs2(Fragment4, { children: [
8557
8574
  /* @__PURE__ */ jsx5(Title, { "data-testid": "editor_error", children: "Sorry, something went wrong!" }),
8558
8575
  /* @__PURE__ */ jsx5("p", { children: String(this.props.error) })
@@ -8564,7 +8581,7 @@ var ErrorBoundary = class extends React.Component {
8564
8581
  var ErrorBoundary_default = ErrorBoundary;
8565
8582
 
8566
8583
  // src/editor/components/Editor.tsx
8567
- import { forwardRef, memo, useImperativeHandle, useMemo, useState as useState2 } from "react";
8584
+ import { forwardRef, memo as memo2, useImperativeHandle, useMemo, useState as useState2 } from "react";
8568
8585
 
8569
8586
  // src/editor/components/useContextMounted.tsx
8570
8587
  import { useRemirrorContext as useRemirrorContext2 } from "@remirror/react-core";
@@ -8580,7 +8597,7 @@ var useContextMounted = (onContextMounted) => {
8580
8597
 
8581
8598
  // src/editor/components/Editor.tsx
8582
8599
  import { jsx as jsx6 } from "react/jsx-runtime";
8583
- var Editor = memo(
8600
+ var Editor = memo2(
8584
8601
  forwardRef((props, ref) => {
8585
8602
  const { initialType = "wysiwyg", hooks = [], onContextMounted, ...otherProps } = props;
8586
8603
  const [type, setType] = useState2(initialType);
@@ -8878,11 +8895,11 @@ import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMem
8878
8895
  import { usePopper } from "react-popper";
8879
8896
 
8880
8897
  // src/editor/toolbar/SlashMenu/SlashMenuRoot.tsx
8881
- import { memo as memo3, useCallback, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState4 } from "react";
8898
+ import { memo as memo4, useCallback, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState4 } from "react";
8882
8899
  import styled7, { css as css3 } from "styled-components";
8883
8900
 
8884
8901
  // src/editor/toolbar/SlashMenu/TablePanel.tsx
8885
- import { forwardRef as forwardRef2, useState as useState3, useImperativeHandle as useImperativeHandle2, memo as memo2 } from "react";
8902
+ import { forwardRef as forwardRef2, useState as useState3, useImperativeHandle as useImperativeHandle2, memo as memo3 } from "react";
8886
8903
  import styled6 from "styled-components";
8887
8904
  import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
8888
8905
  var TablePanelCell = styled6.div.attrs((p) => p)`
@@ -8893,7 +8910,7 @@ var TablePanelCell = styled6.div.attrs((p) => p)`
8893
8910
  height: 10px;
8894
8911
  background-color: ${(props) => props.inScope ? props.theme.blue : props.theme.contextMenuBgColor};
8895
8912
  `;
8896
- var TablePanel = memo2(
8913
+ var TablePanel = memo3(
8897
8914
  forwardRef2((props, ref) => {
8898
8915
  const { commands, closeMenu } = props;
8899
8916
  const [rowsCount, setRowsCount] = useState3(3);
@@ -8977,7 +8994,7 @@ var darken = (color, amount) => Color(color).darken(amount).string();
8977
8994
 
8978
8995
  // src/editor/toolbar/SlashMenu/SlashMenuRoot.tsx
8979
8996
  import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
8980
- var SlashMenuRoot = memo3(
8997
+ var SlashMenuRoot = memo4(
8981
8998
  ({ rootRef, commands, closeMenu }) => {
8982
8999
  const componentRefMap = useRef2({});
8983
9000
  const menuItems = useMemo2(() => {
@@ -9333,7 +9350,7 @@ var WysiwygEditor = (props) => {
9333
9350
  }
9334
9351
  ) }) });
9335
9352
  };
9336
- var WysiwygEditor_default = memo4(WysiwygEditor);
9353
+ var WysiwygEditor_default = memo5(WysiwygEditor);
9337
9354
 
9338
9355
  // src/editor/extensions/Find/find-extension.ts
9339
9356
  var FindExtension = class extends PlainExtension5 {
@@ -16673,7 +16690,7 @@ var ImageToolTips = (props) => {
16673
16690
 
16674
16691
  // src/editor/components/Resizable/Resizable.tsx
16675
16692
  import styled9 from "styled-components";
16676
- import { useRef as useRef4, useEffect as useEffect5, useCallback as useCallback4, memo as memo5, useState as useState7 } from "react";
16693
+ import { useRef as useRef4, useEffect as useEffect5, useCallback as useCallback4, memo as memo6, useState as useState7 } from "react";
16677
16694
 
16678
16695
  // node_modules/@remirror/core-helpers/dist/remirror-core-helpers.js
16679
16696
  var import_make_error = __toESM(require_make_error(), 1);
@@ -16989,7 +17006,7 @@ var ResizableContainer = styled9.div`
16989
17006
  transition: all 0.15s ease-out;
16990
17007
  `;
16991
17008
  var MIN_WIDTH = 20;
16992
- var Resizable = memo5((props) => {
17009
+ var Resizable = memo6((props) => {
16993
17010
  const {
16994
17011
  node,
16995
17012
  aspectRatio = 0 /* Fixed */,
@@ -17842,7 +17859,7 @@ var ClipboardExtension = class extends PlainExtension7 {
17842
17859
  };
17843
17860
 
17844
17861
  // src/editor/extensions/HtmlBr/br-extension.ts
17845
- import { extension as extension7, ExtensionTag as ExtensionTag3, NodeExtension as NodeExtension4 } from "@remirror/core";
17862
+ import { extension as extension7, ExtensionTag as ExtensionTag3, NodeExtension as NodeExtension4, nodeInputRule as nodeInputRule4 } from "@remirror/core";
17846
17863
  var HtmlBrExtension = class extends NodeExtension4 {
17847
17864
  get name() {
17848
17865
  return "html_br";
@@ -17867,6 +17884,15 @@ var HtmlBrExtension = class extends NodeExtension4 {
17867
17884
  }
17868
17885
  };
17869
17886
  }
17887
+ createInputRules() {
17888
+ const rules = [
17889
+ nodeInputRule4({
17890
+ regexp: new RegExp("<br/>"),
17891
+ type: this.type
17892
+ })
17893
+ ];
17894
+ return rules;
17895
+ }
17870
17896
  fromMarkdown() {
17871
17897
  return [
17872
17898
  {
@@ -17887,68 +17913,373 @@ HtmlBrExtension = __decorateClass([
17887
17913
  })
17888
17914
  ], HtmlBrExtension);
17889
17915
 
17890
- // src/editor/extensions/HtmlNode/html-inline-extension.ts
17891
- import { MarkExtension as MarkExtension2, extension as extension8 } from "remirror";
17892
- var LineHtmlInlineExtension = class extends MarkExtension2 {
17916
+ // src/editor/extensions/HtmlNode/html-inline-node.tsx
17917
+ import {
17918
+ ExtensionTag as ExtensionTag4,
17919
+ NodeExtension as NodeExtension5,
17920
+ extension as extension8,
17921
+ nodeInputRule as nodeInputRule5
17922
+ } from "remirror";
17923
+
17924
+ // src/editor/extensions/HtmlNode/html-inline-view.ts
17925
+ import {
17926
+ EditorState as EditorState2,
17927
+ TextSelection as TextSelection5,
17928
+ Plugin
17929
+ } from "@remirror/pm/state";
17930
+ import { EditorView as EditorView6 } from "@remirror/pm/view";
17931
+ import { keymap as keymap3 } from "@remirror/pm/keymap";
17932
+ import { history as history2, redo as redo2, undo as undo2 } from "@remirror/pm/history";
17933
+ function collapseCmd(outerView, dir, requireOnBorder, requireEmptySelection = true) {
17934
+ return (innerState, dispatch) => {
17935
+ let outerState = outerView.state;
17936
+ let { to: outerTo, from: outerFrom } = outerState.selection;
17937
+ let { to: innerTo, from: innerFrom } = innerState.selection;
17938
+ if (requireEmptySelection && innerTo !== innerFrom) {
17939
+ return false;
17940
+ }
17941
+ let currentPos = dir > 0 ? innerTo : innerFrom;
17942
+ if (requireOnBorder) {
17943
+ let nodeSize2 = innerState.doc.nodeSize - 2;
17944
+ if (dir > 0 && currentPos < nodeSize2) {
17945
+ return false;
17946
+ }
17947
+ if (dir < 0 && currentPos > 0) {
17948
+ return false;
17949
+ }
17950
+ }
17951
+ if (dispatch) {
17952
+ let targetPos = dir > 0 ? outerTo : outerFrom;
17953
+ outerView.dispatch(
17954
+ outerState.tr.setSelection(TextSelection5.create(outerState.doc, targetPos))
17955
+ );
17956
+ outerView.focus();
17957
+ }
17958
+ return true;
17959
+ };
17960
+ }
17961
+ var HTMLInlineView = class {
17962
+ constructor(node, view, getPos) {
17963
+ this.options = {};
17964
+ this._node = node;
17965
+ this._outerView = view;
17966
+ this._getPos = getPos;
17967
+ this._isEditing = false;
17968
+ this._tagName = "span";
17969
+ this.dom = document.createElement(this._tagName);
17970
+ this.dom.classList.add("inline-html");
17971
+ this._htmlRenderElt = document.createElement("span");
17972
+ this._htmlRenderElt.textContent = "";
17973
+ this._htmlRenderElt.classList.add("inline-html-render");
17974
+ this.dom.appendChild(this._htmlRenderElt);
17975
+ this._htmlSrcElt = document.createElement("span");
17976
+ this._htmlSrcElt.spellcheck = false;
17977
+ this.dom.appendChild(this._htmlSrcElt);
17978
+ this.dom.addEventListener("click", () => this.ensureFocus());
17979
+ if (node.attrs.fromInput) {
17980
+ setTimeout(() => {
17981
+ this.openEditor();
17982
+ });
17983
+ } else {
17984
+ this.renderHtml();
17985
+ }
17986
+ console.log("this._node.attrs", this._node.attrs);
17987
+ }
17988
+ destroy() {
17989
+ this.closeEditor(false);
17990
+ if (this._htmlRenderElt) {
17991
+ this._htmlRenderElt.remove();
17992
+ delete this._htmlRenderElt;
17993
+ }
17994
+ if (this._htmlSrcElt) {
17995
+ this._htmlSrcElt.remove();
17996
+ delete this._htmlSrcElt;
17997
+ }
17998
+ this.dom.remove();
17999
+ }
18000
+ ensureFocus() {
18001
+ if (this._innerView && this._outerView.hasFocus()) {
18002
+ this._innerView.focus();
18003
+ }
18004
+ }
18005
+ // == Updates ======================================= //
18006
+ update(node, decorations) {
18007
+ if (!node.sameMarkup(this._node))
18008
+ return false;
18009
+ this._node = node;
18010
+ console.log("update", node);
18011
+ if (!this._isEditing) {
18012
+ this.renderHtml();
18013
+ }
18014
+ return true;
18015
+ }
18016
+ // == Events ===================================== //
18017
+ selectNode() {
18018
+ if (!this._outerView.editable) {
18019
+ return;
18020
+ }
18021
+ if (!this._isEditing) {
18022
+ this.openEditor();
18023
+ }
18024
+ }
18025
+ deselectNode() {
18026
+ if (this._isEditing) {
18027
+ this.closeEditor();
18028
+ }
18029
+ }
18030
+ stopEvent(event) {
18031
+ return this._innerView !== void 0 && event.target !== void 0 && this._innerView.dom.contains(event.target);
18032
+ }
18033
+ ignoreMutation() {
18034
+ return true;
18035
+ }
18036
+ // == Rendering ===================================== //
18037
+ renderHtml(preview = false) {
18038
+ if (!this._htmlRenderElt) {
18039
+ return;
18040
+ }
18041
+ let content = this._innerView?.state.doc.textContent || this._node.attrs?.htmlText || "";
18042
+ let texString = content.trim();
18043
+ if (texString.length < 1) {
18044
+ while (this._htmlRenderElt.firstChild) {
18045
+ this._htmlRenderElt.firstChild.remove();
18046
+ }
18047
+ return;
18048
+ } else {
18049
+ }
18050
+ try {
18051
+ while (this._htmlRenderElt.firstChild) {
18052
+ this._htmlRenderElt.firstChild.remove();
18053
+ }
18054
+ const renderEl = document.createElement("span");
18055
+ const domParser = new DOMParser();
18056
+ const doc = domParser.parseFromString(texString, "text/html");
18057
+ doc.body.childNodes.forEach((child) => {
18058
+ if (isImageElement(child) && child.src && this.options.handleViewImgSrcUrl) {
18059
+ let targetUrl = child.src;
18060
+ if (child.src.includes(location.origin)) {
18061
+ targetUrl = child.src.split(location.origin)[1];
18062
+ }
18063
+ this.options.handleViewImgSrcUrl(targetUrl).then((newHref) => {
18064
+ child.src = newHref;
18065
+ });
18066
+ }
18067
+ renderEl.appendChild(child);
18068
+ });
18069
+ if (renderEl.childNodes.length === 1) {
18070
+ this._htmlRenderElt.remove();
18071
+ this._htmlRenderElt = renderEl.firstElementChild;
18072
+ }
18073
+ if (this._htmlRenderElt) {
18074
+ this.dom.append(this._htmlRenderElt);
18075
+ this._htmlRenderElt.classList.remove("node-hide");
18076
+ this._htmlRenderElt.classList.add("inline-node-show");
18077
+ if (preview) {
18078
+ this._htmlRenderElt.classList.add("inline-html-preview");
18079
+ }
18080
+ this._htmlRenderElt.innerHTML = texString;
18081
+ }
18082
+ } catch (err) {
18083
+ console.error(err);
18084
+ this._htmlRenderElt?.classList.add("parse-error");
18085
+ this.dom.setAttribute("title", err.toString());
18086
+ }
18087
+ }
18088
+ // == Inner Editor ================================== //
18089
+ dispatchInner(tr) {
18090
+ if (!this._innerView) {
18091
+ return;
18092
+ }
18093
+ let { state } = this._innerView.state.applyTransaction(tr);
18094
+ this._innerView.updateState(state);
18095
+ this.renderHtml(true);
18096
+ }
18097
+ openEditor() {
18098
+ if (this._innerView) {
18099
+ console.warn("[HTMLInlineView] editor already open when openEditor was called");
18100
+ return;
18101
+ }
18102
+ this._innerView = new EditorView6(this._htmlSrcElt, {
18103
+ state: EditorState2.create({
18104
+ doc: this._outerView.state.schema.node("paragraph", null, [
18105
+ this._outerView.state.schema.text(this._node.attrs?.htmlText)
18106
+ ]),
18107
+ plugins: [
18108
+ history2(),
18109
+ keymap3({
18110
+ Tab: (state, dispatch) => {
18111
+ if (dispatch) {
18112
+ dispatch(state.tr.insertText(" "));
18113
+ }
18114
+ return true;
18115
+ },
18116
+ ArrowLeft: collapseCmd(this._outerView, -1, true),
18117
+ ArrowRight: collapseCmd(this._outerView, 1, true),
18118
+ ArrowUp: collapseCmd(this._outerView, -1, true),
18119
+ ArrowDown: collapseCmd(this._outerView, 1, true),
18120
+ "Mod-z": (state, dispatch, view) => {
18121
+ return undo2(state, dispatch, view);
18122
+ },
18123
+ "Shift-Mod-z": (state, dispatch, view) => {
18124
+ return redo2(state, dispatch, view);
18125
+ }
18126
+ }),
18127
+ new Plugin({
18128
+ props: {
18129
+ handleDOMEvents: {
18130
+ blur: (view) => {
18131
+ const pos = this._getPos();
18132
+ if (pos !== void 0) {
18133
+ const text = this._innerView?.state.doc.textContent || "";
18134
+ const tr = this._outerView.state.tr;
18135
+ tr.setNodeAttribute(pos, "fromInput", false);
18136
+ tr.setNodeAttribute(pos, "htmlText", text);
18137
+ this._outerView.dispatch(tr);
18138
+ }
18139
+ this.closeEditor();
18140
+ }
18141
+ }
18142
+ }
18143
+ })
18144
+ ]
18145
+ }),
18146
+ dispatchTransaction: this.dispatchInner.bind(this)
18147
+ });
18148
+ this._innerView.dom.classList.add("inline-html-src");
18149
+ this._innerView.dom.classList.remove("ProseMirror");
18150
+ let innerState = this._innerView.state;
18151
+ this._innerView.focus();
18152
+ let innerPos = innerState.doc.textContent.length || 0;
18153
+ this._innerView.dispatch(
18154
+ innerState.tr.setSelection(TextSelection5.create(innerState.doc, innerPos))
18155
+ );
18156
+ this._htmlRenderElt?.classList.add("inline-html-preview");
18157
+ this._isEditing = true;
18158
+ }
18159
+ /**
18160
+ * Called when the inner ProseMirror editor should close.
18161
+ *
18162
+ * @param render Optionally update the rendered html after closing. (which
18163
+ * is generally what we want to do, since the user is done editing!)
18164
+ */
18165
+ closeEditor(render = true) {
18166
+ if (this._innerView) {
18167
+ const pos = this._getPos();
18168
+ if (pos !== void 0) {
18169
+ const text = this._innerView.state.doc.textContent || "";
18170
+ }
18171
+ this._innerView?.destroy();
18172
+ this._innerView = void 0;
18173
+ }
18174
+ if (render) {
18175
+ this.renderHtml();
18176
+ this._htmlRenderElt?.classList.add("inline-html-render");
18177
+ this._htmlRenderElt?.classList.remove("inline-html-preview");
18178
+ }
18179
+ this._isEditing = false;
18180
+ }
18181
+ };
18182
+
18183
+ // src/editor/extensions/HtmlNode/html-inline-node.tsx
18184
+ import block_names2 from "markdown-it/lib/common/html_blocks.mjs";
18185
+ var attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*";
18186
+ var unquoted = "[^\"'=<>`\\x00-\\x20]+";
18187
+ var single_quoted = "'[^']*'";
18188
+ var double_quoted = '"[^"]*"';
18189
+ var attr_value = "(?:" + unquoted + "|" + single_quoted + "|" + double_quoted + ")";
18190
+ var attribute = "(?:\\s+" + attr_name + "(?:\\s*=\\s*" + attr_value + ")?)";
18191
+ var open_tag = "<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/?>";
18192
+ var close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
18193
+ var HTML_OPEN_CLOSE_TAG_RE = new RegExp("(?:" + open_tag + "|" + close_tag + ")", "g");
18194
+ var HtmlInlineNodeExtension = class extends NodeExtension5 {
17893
18195
  get name() {
17894
- return "mdHtmlInline";
18196
+ return "html_inline_node";
17895
18197
  }
17896
- createMarkSpec() {
18198
+ createTags() {
18199
+ return [ExtensionTag4.InlineNode];
18200
+ }
18201
+ createNodeSpec() {
17897
18202
  return {
18203
+ inline: true,
18204
+ selectable: true,
18205
+ atom: true,
18206
+ marks: "",
17898
18207
  attrs: {
17899
- depth: { default: 0 },
17900
18208
  key: {
17901
18209
  default: ""
17902
18210
  },
17903
18211
  htmlText: {
17904
18212
  default: ""
18213
+ },
18214
+ fromInput: {
18215
+ default: false
17905
18216
  }
17906
18217
  },
17907
- toDOM: (mark) => [
17908
- "span",
17909
- {
17910
- ...mark.attrs
17911
- },
17912
- 0
17913
- ]
18218
+ toDOM: (node) => {
18219
+ const dom = document.createElement("div");
18220
+ dom.classList.add("inline-html-render");
18221
+ dom.innerHTML = node.attrs.htmlText;
18222
+ return dom;
18223
+ }
17914
18224
  };
17915
18225
  }
17916
18226
  createNodeViews() {
17917
- return (node) => {
17918
- const container = document.createElement("span");
17919
- const domParser = new DOMParser();
17920
- const doc = domParser.parseFromString(node.attrs.htmlText || "", "text/html");
17921
- doc.body.childNodes.forEach((child) => {
17922
- if (isImageElement(child) && child.src && this.options.handleViewImgSrcUrl) {
17923
- let targetUrl = child.src;
17924
- if (child.src.includes(location.origin)) {
17925
- targetUrl = child.src.split(location.origin)[1];
18227
+ return (node, view, getPos) => new HTMLInlineView(node, view, getPos);
18228
+ }
18229
+ createInputRules() {
18230
+ const rules = [
18231
+ nodeInputRule5({
18232
+ regexp: HTML_OPEN_CLOSE_TAG_RE,
18233
+ type: this.type,
18234
+ getAttributes: (match) => {
18235
+ return {
18236
+ htmlText: match[0],
18237
+ fromInput: true
18238
+ };
18239
+ },
18240
+ beforeDispatch: ({ tr, start, match }) => {
18241
+ const $pos = tr.doc.resolve(start);
18242
+ const node = $pos.node(1);
18243
+ console.log("last", node.lastChild);
18244
+ console.log("node", node);
18245
+ },
18246
+ shouldSkip: (props) => {
18247
+ const tagName = getTagName(props.fullMatch);
18248
+ if (needSplitInlineHtmlTokenTags.includes(tagName) || block_names2.includes(tagName)) {
18249
+ return true;
17926
18250
  }
17927
- this.options.handleViewImgSrcUrl(targetUrl).then((newHref) => {
17928
- child.src = newHref;
17929
- });
18251
+ props.state.tr.replaceRangeWith(
18252
+ props.start,
18253
+ props.end,
18254
+ this.type.create({ htmlText: props.fullMatch, fromInput: true })
18255
+ );
18256
+ return false;
17930
18257
  }
17931
- container.appendChild(child);
17932
- });
17933
- const contentDom = document.createElement("span");
17934
- container.appendChild(contentDom);
17935
- container.setAttribute("key", node.attrs.key);
17936
- contentDom.setAttribute("class", "md-html-inline");
17937
- return {
17938
- dom: container,
17939
- contentDOM: contentDom
17940
- };
17941
- };
18258
+ })
18259
+ ];
18260
+ return rules;
18261
+ }
18262
+ fromMarkdown() {
18263
+ return [
18264
+ {
18265
+ type: 6 /* inline */,
18266
+ token: "html_inline_node",
18267
+ node: this.name
18268
+ }
18269
+ ];
18270
+ }
18271
+ toMarkdown({ state, node }) {
18272
+ state.text(node.attrs.htmlText || "");
17942
18273
  }
17943
18274
  };
17944
- LineHtmlInlineExtension.disableExtraAttributes = true;
17945
- LineHtmlInlineExtension = __decorateClass([
18275
+ HtmlInlineNodeExtension.disableExtraAttributes = true;
18276
+ HtmlInlineNodeExtension = __decorateClass([
17946
18277
  extension8({
17947
18278
  defaultOptions: {
17948
18279
  handleViewImgSrcUrl: async (src) => src
17949
18280
  }
17950
18281
  })
17951
- ], LineHtmlInlineExtension);
18282
+ ], HtmlInlineNodeExtension);
17952
18283
 
17953
18284
  // src/editor/extensions/index.ts
17954
18285
  function extensions({ handleViewImgSrcUrl }) {
@@ -17965,9 +18296,9 @@ function extensions({ handleViewImgSrcUrl }) {
17965
18296
  new IframeExtension({
17966
18297
  enableResizing: true
17967
18298
  }),
17968
- new LineHtmlInlineExtension({
17969
- handleViewImgSrcUrl
17970
- }),
18299
+ // new LineHtmlInlineExtension({
18300
+ // handleViewImgSrcUrl,
18301
+ // }),
17971
18302
  new PlaceholderExtension({ placeholder: "Type '/' for commands" }),
17972
18303
  new LineHorizontalRuleExtension({}),
17973
18304
  new LineParagraphExtension(),
@@ -17989,6 +18320,9 @@ function extensions({ handleViewImgSrcUrl }) {
17989
18320
  activeDecoration: { style: "background-color: orange; color: black" }
17990
18321
  }),
17991
18322
  new LineHtmlBlockExtension(),
18323
+ new HtmlInlineNodeExtension({
18324
+ handleViewImgSrcUrl
18325
+ }),
17992
18326
  new ClipboardExtension(),
17993
18327
  new ReactComponentExtension({}),
17994
18328
  new DropCursorExtension({}),
@@ -18170,7 +18504,7 @@ var MarkdownSerializer = class {
18170
18504
  };
18171
18505
 
18172
18506
  // src/editor/extensions/CodeMirror/codemirror-extension.ts
18173
- import { Decoration as Decoration5, DecorationSet as DecorationSet5 } from "@remirror/pm/view";
18507
+ import { Decoration as Decoration6, DecorationSet as DecorationSet5 } from "@remirror/pm/view";
18174
18508
 
18175
18509
  // src/editor/extensions/CodeMirror/codemirror-lang-menu.tsx
18176
18510
  import { languages as languages2 } from "@codemirror/language-data";
@@ -18994,11 +19328,11 @@ import {
18994
19328
  isEqual,
18995
19329
  isTextSelection as isTextSelection3,
18996
19330
  keyBinding as keyBinding2,
18997
- NodeExtension as NodeExtension5,
18998
- nodeInputRule as nodeInputRule4,
19331
+ NodeExtension as NodeExtension6,
19332
+ nodeInputRule as nodeInputRule6,
18999
19333
  setBlockType as setBlockType2
19000
19334
  } from "@remirror/core";
19001
- import { TextSelection as TextSelection5 } from "@remirror/pm/state";
19335
+ import { TextSelection as TextSelection6 } from "@remirror/pm/state";
19002
19336
 
19003
19337
  // src/editor/extensions/CodeMirror/codemirror-node-view.ts
19004
19338
  var CodeMirror6NodeView = class {
@@ -19056,7 +19390,7 @@ var CodeMirror6NodeView = class {
19056
19390
  // src/editor/extensions/CodeMirror/codemirror-extension.ts
19057
19391
  import { languages as languages3 } from "@codemirror/language-data";
19058
19392
  var fakeIndentedLanguage = "indent-code";
19059
- var LineCodeMirrorExtension = class extends NodeExtension5 {
19393
+ var LineCodeMirrorExtension = class extends NodeExtension6 {
19060
19394
  get name() {
19061
19395
  return "codeMirror";
19062
19396
  }
@@ -19121,12 +19455,12 @@ var LineCodeMirrorExtension = class extends NodeExtension5 {
19121
19455
  return { language };
19122
19456
  };
19123
19457
  return [
19124
- nodeInputRule4({
19458
+ nodeInputRule6({
19125
19459
  regexp,
19126
19460
  type: this.type,
19127
19461
  beforeDispatch: ({ tr, start }) => {
19128
19462
  const $pos = tr.doc.resolve(start);
19129
- tr.setSelection(TextSelection5.near($pos));
19463
+ tr.setSelection(TextSelection6.near($pos));
19130
19464
  },
19131
19465
  getAttributes
19132
19466
  })
@@ -19155,7 +19489,7 @@ var LineCodeMirrorExtension = class extends NodeExtension5 {
19155
19489
  const pos = tr.selection.$from.before();
19156
19490
  const end = pos + nodeSize2 + 1;
19157
19491
  tr.replaceWith(pos, end, this.type.create({ language }));
19158
- tr.setSelection(TextSelection5.near(tr.doc.resolve(pos + 1)));
19492
+ tr.setSelection(TextSelection6.near(tr.doc.resolve(pos + 1)));
19159
19493
  if (dispatch) {
19160
19494
  dispatch(tr);
19161
19495
  }
@@ -19230,7 +19564,7 @@ var LineCodeMirrorExtension = class extends NodeExtension5 {
19230
19564
  return DecorationSet5.empty;
19231
19565
  }
19232
19566
  const { create, destroy } = codemirror_lang_menu_default(found);
19233
- const deco = Decoration5.widget(found.pos, create, {
19567
+ const deco = Decoration6.widget(found.pos, create, {
19234
19568
  ignoreSelection: true,
19235
19569
  stopEvent: () => true,
19236
19570
  key: "language-menu",
@@ -19301,7 +19635,7 @@ var [SourceEditorProvider, useSourceCodeEditor] = createContextState(
19301
19635
  };
19302
19636
  }
19303
19637
  );
19304
- var SourceCodeEditorCore = memo6(
19638
+ var SourceCodeEditorCore = memo7(
19305
19639
  (props) => {
19306
19640
  const { markdownToolBar, styleToken } = props;
19307
19641
  const { content, markText, hooks, isTesting, editable } = useSourceCodeEditor();
@@ -19366,7 +19700,7 @@ var SourceEditor = (props) => {
19366
19700
  }
19367
19701
  );
19368
19702
  };
19369
- var SourceEditor_default = memo6(SourceEditor);
19703
+ var SourceEditor_default = memo7(SourceEditor);
19370
19704
 
19371
19705
  // src/editor/hooks/index.ts
19372
19706
  import { useHelpers, useKeymap, useRemirrorContext as useRemirrorContext4, useCommands as useCommands4 } from "@remirror/react";
@@ -19439,7 +19773,7 @@ import { prosemirrorNodeToHtml } from "remirror";
19439
19773
  import HTML2 from "html-parse-stringify";
19440
19774
  import { useEffect as useEffect8, useState as useState9 } from "react";
19441
19775
  import { nanoid as nanoid3 } from "nanoid";
19442
- import { Loading3QuartersOutlined } from "zens/esm/Icons";
19776
+ import { Icon } from "zens";
19443
19777
  import { jsx as jsx21 } from "react/jsx-runtime";
19444
19778
  var Preview = (props) => {
19445
19779
  const { doc, delegateOptions } = props;
@@ -19491,7 +19825,7 @@ var Preview = (props) => {
19491
19825
  justifyContent: "center",
19492
19826
  alignItems: "center"
19493
19827
  },
19494
- children: /* @__PURE__ */ jsx21(Loading3QuartersOutlined, { spin: true, size: 40 })
19828
+ children: /* @__PURE__ */ jsx21(Icon.Loading3QuartersOutlined, { spin: true, size: 40 })
19495
19829
  }
19496
19830
  );
19497
19831
  }