@kaitify/vue 0.0.4-beta.24 → 0.0.4-beta.25

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.
@@ -2922,7 +2922,20 @@ const formatPlaceholderMerge = ({ editor, node }) => {
2922
2922
  };
2923
2923
  const formatLineBreakSpaceText = ({ editor, node }) => {
2924
2924
  if (node.isText() && !node.isEmpty()) {
2925
- node.textContent = node.textContent.replace(/\r\n/g, "\n").replace(/\u00A0/g, " ").replace(/\uFEFF/g, getZeroWidthText());
2925
+ const originalText = node.textContent;
2926
+ node.textContent = originalText.replace(/\r\n/g, "\n").replace(/\u00A0/g, " ").replace(/\uFEFF/g, getZeroWidthText());
2927
+ if (editor.selection.focused()) {
2928
+ if (editor.selection.start.node.isEqual(node)) {
2929
+ const preText = originalText.slice(0, editor.selection.start.offset);
2930
+ const crlfCount = (preText.match(/\r\n/g) || []).length;
2931
+ editor.selection.start.offset -= crlfCount;
2932
+ }
2933
+ if (editor.selection.end.node.isEqual(node)) {
2934
+ const preText = originalText.slice(0, editor.selection.end.offset);
2935
+ const crlfCount = (preText.match(/\r\n/g) || []).length;
2936
+ editor.selection.end.offset -= crlfCount;
2937
+ }
2938
+ }
2926
2939
  let startPrevNumber = 0;
2927
2940
  let endPrevNumber = 0;
2928
2941
  const regExp = new RegExp(`\\n(?!${getZeroWidthText()})`, "g");