@kaitify/core 0.0.2-beta.15 → 0.0.2-beta.17

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.
@@ -2787,7 +2787,6 @@ const handlerForPasteDrop = async function(dataTransfer) {
2787
2787
  const html = dataTransfer.getData("text/html");
2788
2788
  const text2 = dataTransfer.getData("text/plain");
2789
2789
  const files = dataTransfer.files;
2790
- debugger;
2791
2790
  if (files.length && this.priorityPasteFiles) {
2792
2791
  await handlerForPasteFiles.apply(this, [files]);
2793
2792
  } else if (html && this.allowPasteHtml && !this.selection.start.node.isInCodeBlockStyle()) {
@@ -2979,7 +2978,20 @@ const formatPlaceholderMerge = ({ editor, node }) => {
2979
2978
  };
2980
2979
  const formatLineBreakSpaceText = ({ editor, node }) => {
2981
2980
  if (node.isText() && !node.isEmpty()) {
2982
- node.textContent = node.textContent.replace(/\r\n/g, "\n").replace(/\u00A0/g, " ").replace(/\uFEFF/g, getZeroWidthText());
2981
+ const originalText = node.textContent;
2982
+ node.textContent = originalText.replace(/\r\n/g, "\n").replace(/\u00A0/g, " ").replace(/\uFEFF/g, getZeroWidthText());
2983
+ if (editor.selection.focused()) {
2984
+ if (editor.selection.start.node.isEqual(node)) {
2985
+ const preText = originalText.slice(0, editor.selection.start.offset);
2986
+ const crlfCount = (preText.match(/\r\n/g) || []).length;
2987
+ editor.selection.start.offset -= crlfCount;
2988
+ }
2989
+ if (editor.selection.end.node.isEqual(node)) {
2990
+ const preText = originalText.slice(0, editor.selection.end.offset);
2991
+ const crlfCount = (preText.match(/\r\n/g) || []).length;
2992
+ editor.selection.end.offset -= crlfCount;
2993
+ }
2994
+ }
2983
2995
  let startPrevNumber = 0;
2984
2996
  let endPrevNumber = 0;
2985
2997
  const regExp = new RegExp(`\\n(?!${getZeroWidthText()})`, "g");